Page({
  data: {
    bgpic: '../../image/home_bg.png',
    boxH: '',
    boxW: '', 
    itemW: '',
    itemH:'',
    title:{
      name:"全部游戏",
      style:'title', 
    },
    rule:{
      name:"游戏规则",
      isShowModal:false,
      icon:'../../image/icon_rule.png',
      style: 'rule',
      main: [
        "每答对一题获得1分",
        "好友排行按照累计答题得分排名",
        "答错或时间超时，可选择分享到微信群接着答题，也可重新开始",
      ]   
    },
    level:[{
      name:"初级题库",
      icon:"../../image/game_low.png"
    }, {
      name: "中级题库",
      icon: "../../image/game_mid.png"
    }, {
        name: "高级题库",
        icon: "../../image/game_high.png"
    }, {
      name: "排行榜",
      icon: "../../image/game_rank.png"
    }]
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let res = wx.getSystemInfoSync();  
  },
  
  /**
 * 生命周期函数--监听页面初次渲染完成
 */
  onReady: function () { 

  },
  imageLoad: function (e) {
    //获取图片的原始宽度和高度   
    this.setData({
      itemW: e.detail.width,
      itemH: e.detail.height,
    })
  },
  // 游戏规则显隐
  ruleFn:function(e){
    this.setData({
      'rule.isShowModal': e.currentTarget.dataset.isshow == "1" ? true:false
    })
  },
  itemFn:function(e){
    let index = e.currentTarget.dataset.index+1;
    let url = index == 4 ? "/pages/rank/rank" : "/pages/proSets/proSets?level=" + index*10; 
    wx.navigateTo({
      url: url,
      success: function () {
        // console.log(2)
      },
      fail:function(res){
        // console.log(3)
      }
    }) 
    
  }
 
})